package cn.com.cifi.mars.web.action.common;


import java.util.HashSet;
import java.util.List;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;

import cn.com.cifi.mars.bean.vo.monitoringConsole.PortalTodoVo;
import cn.com.cifi.mars.bean.vo.sys.rsp.CommonProjectByStagesVo;
import cn.com.cifi.mars.bean.vo.sys.rsp.GroupUserVo;
import cn.com.cifi.mars.common.bean.R;
import cn.com.cifi.mars.common.constants.VersionConstant;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

@Api(tags = "公共管理API")
@RequestMapping("/${spring.data.rest.base-path}/{apiVersion}/common")
public interface ICommonController {

    @ApiOperation(value = "上传信息", notes = "上传信息")
    @PostMapping(value = "uploadFiles",headers = "content-type=multipart/*")
    public R uploadFiles(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "上传文件信息", required = true, defaultValue = "")@RequestParam MultipartFile file);

    @ApiOperation(value = "根据组织机构id查询所对应的组织机构数据", notes = "根据组织机构id查询所对应的组织机构数据")
	@GetMapping(value = "orgList")
	public R<CommonProjectByStagesVo> getOrgList(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "区域id", required = false) @RequestParam(name = "regionId", defaultValue = "") String regionId,
			@ApiParam(value = "城市公司id", required = false) @RequestParam(name = "cityId", defaultValue = "") String cityId,
			@ApiParam(value = "项目id", required = false) @RequestParam(name = "projectId", defaultValue = "") String projectId);
	
    @ApiOperation(value = "根据组织机构id和岗位组id查询所对应的用户信息", notes = "根据组织机构id和岗位组id查询所对应的用户信息")
	@GetMapping(value = "groupUserList")
	public R<HashSet<GroupUserVo>> getGroupUserList(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "岗位组id", required = true) @RequestParam(name = "groupId", defaultValue = "") String groupId,
			@ApiParam(value = "组织机构id", required = true) @RequestParam(name = "orgdepId", defaultValue = "") String orgdepId);
	
    @ApiOperation(value = "删除系统日志", notes = "删除系统日志")
	@GetMapping(value = "cleanSysLog")
	R cleanSysLog(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "保留天数", required = true) @RequestParam(value = "day", required = true) int day);
    
    @ApiOperation(value = "清除Redis缓存", notes = "清除Redis缓存")
	@GetMapping(value = "cleanRedisKey")
	R cleanRedisKey(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "key值", required = true) @RequestParam(value = "key", required = true) String key);

	@ApiOperation(value = "获取Redis缓存", notes = "清除Redis缓存")
	@GetMapping(value = "getRedisKey")
	R getRedisKey(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "key值", required = true) @RequestParam(value = "key", required = true) String key);
    
	@ApiOperation(value = "查看门户待办(PC端)", notes = "根据条件查看门户待办")
	@GetMapping(value = "getPcToDo")
	R<List<PortalTodoVo>> getPcToDo(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "待办类型Code(1-货值填报，2-签约编制，3-供货确认，4-预警提醒)", required = false) @RequestParam(value = "todoTypeCode", required = false) String todoTypeCode,
			@ApiParam(value = "项目id", required = false) @RequestParam(value = "projectId", required = false) String projectId,
			@ApiParam(value = "待办id", required = false) @RequestParam(value = "instanceId", required = false) String instanceId);
	
	@ApiOperation(value = "查看门户待办(APP端)", notes = "根据条件查看门户待办")
	@GetMapping(value = "getAppToDo")
	R<List<PortalTodoVo>> getAppToDo(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "待办类型Code(1-货值填报，2-签约编制，3-供货确认，4-预警提醒)", required = false) @RequestParam(value = "todoTypeCode", required = false) String todoTypeCode,
			@ApiParam(value = "项目id", required = false) @RequestParam(value = "projectId", required = false) String projectId,
			@ApiParam(value = "待办实例id", required = false) @RequestParam(value = "instanceId", required = false) String instanceId);
	
	@ApiOperation(value = "根据待办id和操作类型更新流程信息", notes = "根据待办id和操作类型更新流程信息")
	@PostMapping(value = "updatePortalProcess")
	R<String> updatePortalProcess(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "待办id", required = true) @RequestParam(value = "instanceId") String instanceId,
			@ApiParam(value = "操作类型  1/发起流程   2/流程更新   3/删除代办   4/待办转已办  5/抄送新增  6/抄送处理", required = true) @RequestParam(value = "operatorType") String operatorType);
	
	@ApiOperation(value = "消除门户待办(PC端)", notes = "根据条件消除门户待办")
	@GetMapping(value = "cleanPcToDo")
	R cleanPcToDo(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "待办类型Code(1-货值填报，2-签约编制，3-供货确认，4-预警提醒)", required = false) @RequestParam(value = "todoTypeCode", required = false) String todoTypeCode,
			@ApiParam(value = "操作类型  (3-删除代办   4-待办转已办  )",required = true) @RequestParam(value = "operatorType",required = true) String operatorType,
			@ApiParam(value = "项目id", required = false) @RequestParam(value = "projectId", required = false) String projectId,
			@ApiParam(value = "待办实例id", required = false) @RequestParam(value = "instanceId", required = false) String instanceId);
	
	@ApiOperation(value = "消除门户待办(APP端)", notes = "根据条件消除门户待办，"
			+ "待办类型Code：1-货值填报，2-签约编制，3-供货确认，4-预警提醒")
	@GetMapping(value = "cleanAppToDo")
	R cleanAppToDo(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "待办类型Code(1-货值填报，2-签约编制，3-供货确认，4-预警提醒)", required = false) @RequestParam(value = "todoTypeCode", required = false) String todoTypeCode,
			@ApiParam(value = "操作类型  (3-删除代办   4-待办转已办  )",required = true) @RequestParam(value = "operatorType",required = true) String operatorType,
			@ApiParam(value = "项目id", required = false) @RequestParam(value = "projectId", required = false) String projectId,
			@ApiParam(value = "待办实例id(批量有逗号隔开)", required = false) @RequestParam(value = "instanceId", required = false) String instanceId);
    
	@ApiOperation(value = "供货确认归属年月", notes = "供货确认归属年月")
	@GetMapping(value = "supplyConfirmYearMonth")
	R supplyConfirmYearMonth(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "年月", required = true) @RequestParam(value = "yearMonth", required = true) String yearMonth);
    
	
	@ApiOperation(value = "获取认证token",notes = "业务系统与OA集成-获取token")
    @PostMapping(value = "getToken")
    String getToken(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @RequestBody String requestParam);

    @ApiOperation(value = "保存流程实例",notes = "业务系统与OA集成-保存流程实例")
    @PostMapping(value = "saveFlow")
    String saveFlow(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "sessionToken", required = true) @RequestParam(name = "sessionToken") String sessionToken,
            @RequestBody String requestParam);

    @ApiOperation(value = "废弃流程实例",notes = "业务系统与OA集成-废弃流程实例")
    @PostMapping(value = "endFlow")
    String endFlow(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "sessionToken", required = true) @RequestParam(name = "sessionToken") String sessionToken,
            @RequestBody String requestParam);

    @ApiOperation(value = "删除流程实例",notes = "业务系统与OA集成-删除流程实例")
    @PostMapping(value = "deleteFlow")
    String deleteFlow(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "sessionToken", required = true) @RequestParam(name = "sessionToken") String sessionToken,
            @RequestBody String requestParam);

    @ApiOperation(value = "查询流程实例审批记录",notes = "业务系统与OA集成-查询流程实例审批记录")
    @PostMapping(value = "selectFlowOpinions")
    String selectFlowOpinions(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "sessionToken", required = true) @RequestParam(name = "sessionToken") String sessionToken,
            @RequestBody String requestParam);

    @ApiOperation(value = "查询流程实例审批路径",notes = "业务系统与OA集成-查询流程实例审批路径")
    @PostMapping(value = "selectFlowPath")
    String selectFlowPath(
            @ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
            @ApiParam(value = "sessionToken", required = true) @RequestParam(name = "sessionToken") String sessionToken,
            @RequestBody String requestParam);
    
    @ApiOperation(value = "查看预警待办(PC端)", notes = "根据条件查看门户待办")
	@GetMapping(value = "getWarnPcToDo")
	R getWarnPcToDo(
			@ApiParam(value = "接口版本", required = true, 
			defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "待办id", required = false) @RequestParam(value = "instanceId", required = false) String instanceId);
	
    @ApiOperation(value = "查看预警督办待办(PC端)", notes = "根据条件查看门户待办")
	@GetMapping(value = "getWarnSupervisePcToDo")
	R getWarnSupervisePcToDo(
			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
			@ApiParam(value = "待办id", required = false) @RequestParam(value = "instanceId", required = false) String instanceId,
			@ApiParam(value = "用户id", required = false) @RequestParam(value = "userId", required = false) String userId);
	
    @ApiOperation(value = "发送预警督办", notes = "发送预警督办")
  	@GetMapping(value = "sendWarnSupervise")
  	R sendWarnSupervise(
  			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
  			@ApiParam(value = "待办id", required = false) @RequestParam(value = "instanceId", required = false) String instanceId);
  	
    @ApiOperation(value = "获取预算版本标签", notes = "获取预算版本标签")
  	@GetMapping(value = "budgetVersion")
  	R budgetVersion(@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion);
    
    @ApiOperation(value = "创建签约、回款版本检验", notes = "创建签约、回款版本检验（勾选预算版本标识时才校验）")
  	@GetMapping(value = "createBudgetVerify")
  	R createBudgetVerify(
  			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
  			@ApiParam(value = "项目id", required = true) @RequestParam(value = "projectId", required = true) String projectId,
  			@ApiParam(value = "分期id", required = true) @RequestParam(value = "stageId", required = true) String stageId,
  			@ApiParam(value = "类型（sign/return）", required = true) @RequestParam(value = "type", required = true) String type);

    @ApiOperation(value = "发送预警督办审批测试", notes = "发送预警督办审批测试")
  	@GetMapping(value = "warningSuperviseTest")
  	R warningSuperviseTest(
  			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
  			@ApiParam(value = "审批ID", required = false) @RequestParam(value = "billId", required = false) String billId,
  			@ApiParam(value = "类型", required = false) @RequestParam(value = "eventType", required = false) Integer eventType);
  	
    @ApiOperation(value = "保存货值审批Excel数据测试", notes = "保存货值审批Excel数据测试")
  	@GetMapping(value = "savePriceExcelData")
  	R savePriceExcelData(
  			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
  			@ApiParam(value = "审批ID", required = true) @RequestParam(value = "billId", required = true) String billId,
  			@ApiParam(value = "类型", required = true,defaultValue = "success_approved") @RequestParam(value = "versionState", required = true) String versionState,
  			@ApiParam(value = "项目ID", required = true) @RequestParam(value = "projectId", required = true)String projectId);
  	

    @ApiOperation(value = "处理数据测试", notes = "处理数据测试")
    @PutMapping(value = "handleData")
  	R handleData(
  			@ApiParam(value = "接口版本", required = true, defaultValue = VersionConstant.V1) @PathVariable(value = "apiVersion") String apiVersion,
  			@RequestBody String str);

}
